/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.eventos.be;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
//import javax.persistence.NamedQueries;
//import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author OscarA
 */
@Entity
@Table(name = "eca_tipo_evento")
//@NamedQueries({@NamedQuery(name = "TipoEvento.findAll", query = "SELECT t FROM TipoEvento t"), @NamedQuery(name = "TipoEvento.findByTevCodigo", query = "SELECT t FROM TipoEvento t WHERE t.tevCodigo = :tevCodigo"), @NamedQuery(name = "TipoEvento.findByTevNombre", query = "SELECT t FROM TipoEvento t WHERE t.tevNombre = :tevNombre"), @NamedQuery(name = "TipoEvento.findByTevActivo", query = "SELECT t FROM TipoEvento t WHERE t.tevActivo = :tevActivo")})
public class TipoEvento implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "tev_codigo", nullable = false)
    private Integer tevCodigo;
    @Basic(optional = false)
    @Column(name = "tev_nombre", nullable = false, length = 50)
    private String tevNombre;
    @Basic(optional = false)
    @Column(name = "tev_activo", nullable = false)
    private Boolean tevActivo;
    @Basic(optional = false)
    @Column(name = "tev_tipo", nullable = false)
    private Integer tevTipo;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tevCodigo", fetch = FetchType.LAZY)
    private List<Preevento> preeventoCollection;

    public TipoEvento() {
    }

    public TipoEvento(Integer tevCodigo) {
        this.tevCodigo = tevCodigo;
    }

    public TipoEvento(Integer tevCodigo, String tevNombre, boolean tevActivo) {
        this.tevCodigo = tevCodigo;
        this.tevNombre = tevNombre;
        this.tevActivo = tevActivo;
    }

    public Integer getTevCodigo() {
        return tevCodigo;
    }

    public void setTevCodigo(Integer tevCodigo) {
        this.tevCodigo = tevCodigo;
    }

    public String getTevNombre() {
        return tevNombre;
    }

    public void setTevNombre(String tevNombre) {
        this.tevNombre = tevNombre;
    }

    public Boolean getTevActivo() {
        return tevActivo;
    }

    public void setTevActivo(Boolean tevActivo) {
        this.tevActivo = tevActivo;
    }

    public Integer getTevTipo() {
        return tevTipo;
    }

    public void setTevTipo(Integer tevTipo) {
        this.tevTipo = tevTipo;
    }



    public List<Preevento> getPreeventoCollection() {
        return preeventoCollection;
    }

    public void setPreeventoCollection(List<Preevento> preeventoCollection) {
        this.preeventoCollection = preeventoCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tevCodigo != null ? tevCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TipoEvento)) {
            return false;
        }
        TipoEvento other = (TipoEvento) object;
        if ((this.tevCodigo == null && other.tevCodigo != null) || (this.tevCodigo != null && !this.tevCodigo.equals(other.tevCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.cip.esymons.eventos.be.TipoEvento[tevCodigo=" + tevCodigo + "]";
    }

}
